<?php
  include '../base.php';
	$imgname = $_FILES['file']['name'];
    $tmp = $_FILES['file']['tmp_name'];
    $filepath = '../uploads/temp.png';
    
    $data = [];
    
    if(move_uploaded_file($tmp,$filepath)){
        $file = realpath($filepath);

        if($fp = fopen($file,"rb", 0))
        {
            $gambar = fread($fp,filesize($file));
            fclose($fp);
            $base64 = chunk_split(base64_encode($gambar));
            $data['uploadFile'] = "data:image/jpg/png/gif;base64,$base64";
        }

        $data['errmsg'] = '上传成功';
    }else{
        $data['errmsg'] = '上传Failed';
    }


    echo json_encode($data);

	mysqli_close($conn);



?>